package pack0707;

import java.util.HashMap;
import java.util.Map;

//演示map的使用
public class MapDemo {
    public static void main(String[] args) {
//        Map<String,String> map=new HashMap<>();
//
//        map.put("a","aaa");
//        map.put("a","bbb");
//        map.put("a","ccc");
//        map.put("a","ddd");
//        map.put("a","eee");
//
//        System.out.println(map.size());
//        System.out.println(map.get("a"));   //被替换掉

        Map<Person,String> map1=new HashMap<>();
        map1.put(new Person("张无忌",20),"aaaa");
        map1.put(new Person("张无忌",20),"bbbb");
        map1.put(new Person("张无忌",20),"cccc");
        map1.put(new Person("张无忌",20),"dddd");

        System.out.println(map1);
        System.out.println(new Person("张无忌",20));
        System.out.println(map1.size());
        System.out.println(map1.get(new Person("张无忌",20)));


    }
}
